package com.chuan.rabbitmq.product.controller;

import com.chuan.rabbitmq.product.service.DirectOrderService;
import com.chuan.rabbitmq.product.service.OrderService;
import com.chuan.rabbitmq.product.service.TopicOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class IndexController {

    @Autowired
    OrderService orderService;
    @Autowired
    DirectOrderService directOrderService;
    @Autowired
    TopicOrderService topicOrderService;

    @GetMapping("/fanout")
    public String fanoutController(){
        String order = orderService.makeOrder();
        return order;
    }

    @GetMapping("/direct")
    public String directController(){
        String order = directOrderService.makeOrder();
        return order;
    }

    @GetMapping("/topic")
    public String topicController(){
        String order = topicOrderService.makeOrder();
        return order;
    }
}
